s = input('请输入数字：')
numbers = [int(x) for x in s.split(',')]

for i in range((len(numbers) - 1) // 2):
    for j in range(len(numbers) - i - 2):
        if numbers[j] > numbers[j + 2]:
            numbers[j], numbers[j + 2] = numbers[j + 2], numbers[j]

for i in range(len(numbers) // 2):
    j = 2 * i
    if numbers[j] > numbers[j + 1]:
        numbers[j], numbers[j + 1] = numbers[j + 1], numbers[j]

for i in range(2, len(numbers) - 1, 2):
    t = numbers[i]
    j = i - 1
    while t < numbers[j]:
        numbers[j + 1] = numbers[j]
        j -= 1
    numbers[j + 1] = t
print(numbers)
